package com.css.fxfzysx.modules.lifeline.service.impl;

import cn.hutool.core.io.FileUtil;
import com.css.fxfzysx.base.attachment.entity.AttachmentInfoEntity;
import com.css.fxfzysx.base.attachment.service.AttachmentInfoService;
import com.css.fxfzysx.base.dict.service.DictService;
import com.css.fxfzysx.base.response.RestResponse;
import com.css.fxfzysx.constants.YNEnum;
import com.css.fxfzysx.modules.cztDataMange.entity.RdInformationEntity;
import com.css.fxfzysx.modules.cztDataMange.exception.ShpFieldException;
import com.css.fxfzysx.modules.cztDataMange.repository.DomeFacilitiesRepository;
import com.css.fxfzysx.modules.cztDataMange.result.ParsingResult;
import com.css.fxfzysx.modules.lifeline.constants.RoadEnum;
import com.css.fxfzysx.modules.lifeline.entity.*;
import com.css.fxfzysx.modules.lifeline.entity.newEntity.SmxRoadEntity;
import com.css.fxfzysx.modules.lifeline.entity.newEntity.SmxVersionEntity;
import com.css.fxfzysx.modules.lifeline.param.RegionParam;
import com.css.fxfzysx.modules.lifeline.repository.LifelineRepository;
import com.css.fxfzysx.modules.lifeline.service.LifelineService;
import com.css.fxfzysx.modules.lifeline.utils.VersionCodeUtils;
import com.css.fxfzysx.modules.lifeline.vo.QueryParamsVo;
import com.css.fxfzysx.modules.vaolEngineering.service.CarVulnerabilityService;
import com.css.fxfzysx.util.*;
import com.css.fxfzysx.web.PlatformSessionContext;
import com.css.fxfzysx.zcpt.sys.entity.SUser;
import com.css.fxfzysx.zcpt.sys.service.SUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;


@Service
@Slf4j
public class LifelineServiceImpl implements LifelineService {

    @Autowired
    private AttachmentInfoService attachmentInfoService;

    @Autowired
    private DictService dictService;
    @Autowired
    private DomeFacilitiesRepository domeFacilitiesRepository;

    @Autowired
    private CarVulnerabilityService carVulnerabilityService;

    @Autowired
    private SUserService userService;

    @Autowired
    private VersionCodeUtils versionCodeUtils;

    @Value("${image.localDir}")
    private String localDir;

    @Autowired
    LifelineRepository lifelineRepository;

    /*
    type 1:地下管网   2:水厂泵房  3:水厂水池  4:燃气-储气罐    5:桥梁    6:道路    7:变电站
     8:架空线路  9:电缆线路  10:发电厂  11:通信室内设备   12:电视塔   14:水库大坝
     */
    @Transactional(rollbackFor = Exception.class)
    @Override
    public Map<String, Object> uploadShp(RegionParam param) {
        Integer type = param.getType();
        String fileIds = param.getFileIds();
        String versionId = "";
        //保存版本信息
        if(param.getCover() == 1){
            versionId = updateVersionInfo(param);
            //删除历史的数据
            lifelineRepository.deleteOldVersionData(versionId,type);
        }else {
            versionId = saveVersionInfo(param);
        }

        Map<String, Object> map = new HashMap<>();
        try {
            if (type == 1) {
                map = uploadDxPipeNetworkShp(fileIds);
            } else if (type == 2) {
                map = uploadWaterworksShp(fileIds);
            } else if (type == 3) {
                map = uploadPoolShp(fileIds);
            } else if (type == 4) {
                map = uploadAirReceiverShp(fileIds);
            } else if (type == 5) {
                map = uploadBridgeShp(fileIds);
            } else if (type == 6) {
                map = uploadRoadShp(fileIds,versionId);
            } else if (type == 7) {
                map = uploadTransformerSubstationShp(fileIds);
            } else if (type == 8) {
                map = uploadOverheadLineShp(fileIds);
            } else if (type == 9) {
                map = uploadCableRouteShp(fileIds);
            } else if (type == 10) {
                map = uploadImportantPowerhouseShp(fileIds);
            } else if (type == 11) {
                map = uploadCommIndoorEquipmentShp(fileIds);
            } else if (type == 12) {
                map = uploadTvTowerShp(fileIds);
            } else if (type == 13) {

            } else if (type == 14) {
                map = uploadReserviorShp(fileIds);
            }
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            map.put("res", false);
            map.put("mess", "该数据类别下没有shp数据");
        }
        return map;
    }

    private String updateVersionInfo(RegionParam param) {
        SmxVersionEntity entity = new SmxVersionEntity();
        entity.setFileIds(param.getFileIds());
        entity.setUpdateTime(PlatformDateUtils.getCurrentTimestamp());
        entity.setUpdateUser(PlatformSessionContext.getUserID());
        entity.setId(param.getId());
        return entity.getId();
    }

    private String saveVersionInfo(RegionParam param) {
        SmxVersionEntity entity = new SmxVersionEntity();
        entity.setId(UUIDGenerator.getUUID());
        entity.setVersionCode(versionCodeUtils.getVersionCode(param.getType()));
        entity.setProvince(param.getProvince());
        entity.setCity(param.getCity());
        entity.setCounty(param.getCounty());
        entity.setFileIds(param.getFileIds());
        AttachmentInfoEntity attach = attachmentInfoService.getAttach(param.getFileIds().split(",")[0]);
        entity.setFileName(attach.getAttachName());
        entity.setCreateUser(PlatformSessionContext.getUserID());
        entity.setCreateUserName(getUserName().getUserName());
        entity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
        entity.setDelFlag("0");
        entity.setType(param.getType());
        return entity.getId();
    }

    private Map<String, Object> uploadReserviorShp(String fileIds) throws ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res", false);
            map.put("mess", shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<RdInformationEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 20) {
                return null;
            }
            RdInformationEntity rdInformationEntity = new RdInformationEntity();
            rdInformationEntity.setCreateUser(PlatformSessionContext.getUserID());
            rdInformationEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            rdInformationEntity.setDelFlag(YNEnum.N.toString());
            rdInformationEntity.setAttachId(fileIds);
            rdInformationEntity.setCrId(UUIDGenerator.getUUID());
            if (!PlatformObjectUtils.isEmpty(list.get(0))) {
                rdInformationEntity.setGeom(list.get(0).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(2))) {
                rdInformationEntity.setCrName(ShpAnalyticUtil.getStringVal(list.get(2).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(3))) {
                rdInformationEntity.setLocation(ShpAnalyticUtil.getStringVal(list.get(3).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(4))) {
                rdInformationEntity.setLongitude(ShpAnalyticUtil.getStringVal(list.get(4).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(5))) {
                rdInformationEntity.setLatitude(ShpAnalyticUtil.getStringVal(list.get(5).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(6))) {
                rdInformationEntity.setCapacity(ShpAnalyticUtil.getDoubleVal(list.get(6).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(7))) {
                rdInformationEntity.setYear(ShpAnalyticUtil.getStringVal(list.get(7).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(8))) {
                rdInformationEntity.setDamLength(ShpAnalyticUtil.getDoubleVal(list.get(8).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(9))) {
                rdInformationEntity.setDamHeight(ShpAnalyticUtil.getDoubleVal(list.get(9).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(10))) {
                rdInformationEntity.setTopWidth(ShpAnalyticUtil.getDoubleVal(list.get(10).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(11))) {
                rdInformationEntity.setStructureType(getKeyByValue("smxskdbjglx", ShpAnalyticUtil.getStringVal(list.get(11).toString(), "", false)));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(12))) {
                rdInformationEntity.setType(getKeyByValue("smxskdbsblx", ShpAnalyticUtil.getStringVal(list.get(12).toString(), "", false)));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(13))) {
                rdInformationEntity.setIntensity(ShpAnalyticUtil.getStringVal(list.get(13).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(14))) {
                rdInformationEntity.setSite(ShpAnalyticUtil.getStringVal(list.get(14).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(15))) {
                rdInformationEntity.setSpace(getKeyByValue("smxskdbcd", ShpAnalyticUtil.getStringVal(list.get(15).toString(), "", false)));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(16))) {
                rdInformationEntity.setFilling(getKeyByValue("smxskdbtl", ShpAnalyticUtil.getStringVal(list.get(16).toString(), "", false)));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(17))) {
                rdInformationEntity.setDamFoundation(getKeyByValue("smxskdbbj", ShpAnalyticUtil.getStringVal(list.get(17).toString(), "", false)));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(18))) {
                rdInformationEntity.setMaintenanceStatus(getKeyByValue("smxskdbwhxz", ShpAnalyticUtil.getStringVal(list.get(18).toString(), "", false)));
            }
            if (list.size() > 19 && !PlatformObjectUtils.isEmpty(list.get(19))) {
                rdInformationEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(19).toString(), "", false));
            }
            if (list.size() > 20 && !PlatformObjectUtils.isEmpty(list.get(20))) {
                rdInformationEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(20).toString(), "", false));
            }
            if (list.size() > 21 && !PlatformObjectUtils.isEmpty(list.get(21))) {
                rdInformationEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(21).toString(), "", false));
            }
            if (list.size() > 22 && !PlatformObjectUtils.isEmpty(list.get(22))) {
                rdInformationEntity.setExtends1(list.get(22).toString());
            }
            if (list.size() > 23 && !PlatformObjectUtils.isEmpty(list.get(23))) {
                rdInformationEntity.setExtends2(list.get(23).toString());
            }
            if (list.size() > 24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                rdInformationEntity.setExtends3(list.get(24).toString());
            }
            if (list.size() > 25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                rdInformationEntity.setExtends4(list.get(25).toString());
            }
            if (list.size() > 26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                rdInformationEntity.setExtends5(list.get(26).toString());
            }
            if (list.size() > 27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                rdInformationEntity.setExtends6(list.get(27).toString());
            }
            if (list.size() > 28 && !PlatformObjectUtils.isEmpty(list.get(28))) {
                rdInformationEntity.setExtends7(list.get(28).toString());
            }
            if (list.size() > 29 && !PlatformObjectUtils.isEmpty(list.get(29))) {
                rdInformationEntity.setExtends8(list.get(29).toString());
            }
            if (list.size() > 30 && !PlatformObjectUtils.isEmpty(list.get(30))) {
                rdInformationEntity.setExtends9(list.get(30).toString());
            }
            if (list.size() > 31 && !PlatformObjectUtils.isEmpty(list.get(31))) {
                rdInformationEntity.setExtends10(list.get(31).toString());
            }
            arrayList.add(rdInformationEntity);
        }
        boolean res = false;
        for (RdInformationEntity rdInformationEntity : arrayList) {
            res = domeFacilitiesRepository.saveRdInformation(rdInformationEntity);
        }
        if (res) {
            for (String attachId : fileIds.split(",")) {
                res = saveLifelineAttachmentRecord(attachId, PlatformSessionContext.getUserID());
            }
        }
        map.put("res", res);
        return map;
    }


    //电视塔shp
    private Map<String, Object> uploadTvTowerShp(String fileIds) throws ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res", false);
            map.put("mess", shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<TvTowerEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 21) {
                return null;
            }
            TvTowerEntity tvTowerEntity = new TvTowerEntity();
            tvTowerEntity.setCreateUser(PlatformSessionContext.getUserID());
            tvTowerEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            tvTowerEntity.setDelFlag(YNEnum.N.toString());
            tvTowerEntity.setAttachId(fileIds);
            tvTowerEntity.setCttId(UUIDGenerator.getUUID());
            if (!PlatformObjectUtils.isEmpty(list.get(0))) {
                tvTowerEntity.setGeom(list.get(0).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(1))) {
                tvTowerEntity.setObjectName(ShpAnalyticUtil.getStringVal(list.get(1).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(2))) {
                tvTowerEntity.setLocation(ShpAnalyticUtil.getStringVal(list.get(2).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(3))) {
                tvTowerEntity.setObjectLon(ShpAnalyticUtil.getStringVal(list.get(3).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(4))) {
                tvTowerEntity.setObjectLat(ShpAnalyticUtil.getStringVal(list.get(4).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(5))) {
                tvTowerEntity.setCttType(ShpAnalyticUtil.getStringVal(list.get(5).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(6))) {
                tvTowerEntity.setArea(ShpAnalyticUtil.getDoubleVal(list.get(6).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(7))) {
                tvTowerEntity.setYear(ShpAnalyticUtil.getStringVal(list.get(7).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(8))) {
                tvTowerEntity.setHeight(ShpAnalyticUtil.getDoubleVal(list.get(8).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(9))) {
                tvTowerEntity.setTowerElevation(ShpAnalyticUtil.getDoubleVal(list.get(9).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(10))) {
                tvTowerEntity.setBuldingSite(ShpAnalyticUtil.getStringVal(list.get(10).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(11))) {
                tvTowerEntity.setDesignIntensity(ShpAnalyticUtil.getIntegerVal(list.get(11).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(12))) {
                tvTowerEntity.setFieldType(ShpAnalyticUtil.getIntegerVal(list.get(12).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(13))) {
                tvTowerEntity.setStatus(ShpAnalyticUtil.getStringVal(list.get(13).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(14))) {
                tvTowerEntity.setReconstructionCost(ShpAnalyticUtil.getDoubleVal(list.get(14).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(15))) {
                tvTowerEntity.setAntennaElevation(ShpAnalyticUtil.getDoubleVal(list.get(15).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(16))) {
                tvTowerEntity.setPeriod(ShpAnalyticUtil.getDoubleVal(list.get(16).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(17))) {
                tvTowerEntity.setColmnType(ShpAnalyticUtil.getStringVal(list.get(17).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(18))) {
                tvTowerEntity.setBaseType(ShpAnalyticUtil.getStringVal(list.get(18).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(19))) {
                tvTowerEntity.setBaseStoryNum(ShpAnalyticUtil.getIntegerVal(list.get(19).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(20))) {
                tvTowerEntity.setBaseHeight(ShpAnalyticUtil.getDoubleVal(list.get(20).toString(), "", false));
            }
            if (list.size() > 21 && !PlatformObjectUtils.isEmpty(list.get(21))) {
                tvTowerEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(21).toString(), "", false));
            }
            if (list.size() > 22 && !PlatformObjectUtils.isEmpty(list.get(22))) {
                tvTowerEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(22).toString(), "", false));
            }
            if (list.size() > 23 && !PlatformObjectUtils.isEmpty(list.get(23))) {
                tvTowerEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(23).toString(), "", false));
            }
            if (list.size() > 24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                tvTowerEntity.setExtends1(list.get(24).toString());
            }
            if (list.size() > 25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                tvTowerEntity.setExtends2(list.get(25).toString());
            }
            if (list.size() > 26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                tvTowerEntity.setExtends3(list.get(26).toString());
            }
            if (list.size() > 27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                tvTowerEntity.setExtends4(list.get(27).toString());
            }
            if (list.size() > 28 && !PlatformObjectUtils.isEmpty(list.get(28))) {
                tvTowerEntity.setExtends5(list.get(28).toString());
            }
            if (list.size() > 29 && !PlatformObjectUtils.isEmpty(list.get(29))) {
                tvTowerEntity.setExtends6(list.get(29).toString());
            }
            if (list.size() > 30 && !PlatformObjectUtils.isEmpty(list.get(30))) {
                tvTowerEntity.setExtends7(list.get(30).toString());
            }
            if (list.size() > 31 && !PlatformObjectUtils.isEmpty(list.get(31))) {
                tvTowerEntity.setExtends8(list.get(31).toString());
            }
            if (list.size() > 32 && !PlatformObjectUtils.isEmpty(list.get(32))) {
                tvTowerEntity.setExtends9(list.get(32).toString());
            }
            if (list.size() > 33 && !PlatformObjectUtils.isEmpty(list.get(33))) {
                tvTowerEntity.setExtends10(list.get(33).toString());
            }
            arrayList.add(tvTowerEntity);
        }
        boolean res = false;
        for (TvTowerEntity tvTowerEntity : arrayList) {
            res = lifelineRepository.saveTvTower(tvTowerEntity);
        }
        if (res) {
            for (String attachId : fileIds.split(",")) {
                res = saveLifelineAttachmentRecord(attachId, PlatformSessionContext.getUserID());
            }
        }
        map.put("res", res);
        return map;
    }

    //通信室内设备shp
    private Map<String, Object> uploadCommIndoorEquipmentShp(String fileIds) throws ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res", false);
            map.put("mess", shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<CommIndoorEquipmentEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 15) {
                return null;
            }
            CommIndoorEquipmentEntity commIndoorEquipmentEntity = new CommIndoorEquipmentEntity();
            commIndoorEquipmentEntity.setCreateUser(PlatformSessionContext.getUserID());
            commIndoorEquipmentEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            commIndoorEquipmentEntity.setDelFlag(YNEnum.N.toString());
            commIndoorEquipmentEntity.setAttachId(fileIds);
            commIndoorEquipmentEntity.setCcieId(UUIDGenerator.getUUID());
            if (!PlatformObjectUtils.isEmpty(list.get(0))) {
                commIndoorEquipmentEntity.setGeom(list.get(0).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(1))) {
                commIndoorEquipmentEntity.setInObjectName(ShpAnalyticUtil.getStringVal(list.get(1).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(2))) {
                commIndoorEquipmentEntity.setLocation(ShpAnalyticUtil.getStringVal(list.get(2).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(3))) {
                commIndoorEquipmentEntity.setObjectLon(ShpAnalyticUtil.getStringVal(list.get(3).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(4))) {
                commIndoorEquipmentEntity.setObjectLat(ShpAnalyticUtil.getStringVal(list.get(4).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(5))) {
                commIndoorEquipmentEntity.setDeviceType(ShpAnalyticUtil.getStringVal(list.get(5).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(6))) {
                commIndoorEquipmentEntity.setDeviceName(ShpAnalyticUtil.getStringVal(list.get(6).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(7))) {
                commIndoorEquipmentEntity.setModel(ShpAnalyticUtil.getStringVal(list.get(7).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(8))) {
                commIndoorEquipmentEntity.setInFloor(ShpAnalyticUtil.getIntegerVal(list.get(8).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(9))) {
                commIndoorEquipmentEntity.setFixedForm(ShpAnalyticUtil.getStringVal(list.get(9).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(10))) {
                commIndoorEquipmentEntity.setBoltDiameter(ShpAnalyticUtil.getDoubleVal(list.get(10).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(11))) {
                commIndoorEquipmentEntity.setPurchaseCost(ShpAnalyticUtil.getDoubleVal(list.get(11).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(12))) {
                commIndoorEquipmentEntity.setManufacturers(ShpAnalyticUtil.getStringVal(list.get(12).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(13))) {
                commIndoorEquipmentEntity.setSize(ShpAnalyticUtil.getStringVal(list.get(13).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(14))) {
                commIndoorEquipmentEntity.setWeight(ShpAnalyticUtil.getDoubleVal(list.get(14).toString(), "", false));
            }
            if (list.size() > 15 && !PlatformObjectUtils.isEmpty(list.get(15))) {
                commIndoorEquipmentEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(15).toString(), "", false));
            }
            if (list.size() > 16 && !PlatformObjectUtils.isEmpty(list.get(16))) {
                commIndoorEquipmentEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(16).toString(), "", false));
            }
            if (list.size() > 17 && !PlatformObjectUtils.isEmpty(list.get(17))) {
                commIndoorEquipmentEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(17).toString(), "", false));
            }
            if (list.size() > 18 && !PlatformObjectUtils.isEmpty(list.get(18))) {
                commIndoorEquipmentEntity.setExtends1(list.get(18).toString());
            }
            if (list.size() > 19 && !PlatformObjectUtils.isEmpty(list.get(19))) {
                commIndoorEquipmentEntity.setExtends2(list.get(19).toString());
            }
            if (list.size() > 20 && !PlatformObjectUtils.isEmpty(list.get(20))) {
                commIndoorEquipmentEntity.setExtends3(list.get(20).toString());
            }
            if (list.size() > 21 && !PlatformObjectUtils.isEmpty(list.get(21))) {
                commIndoorEquipmentEntity.setExtends4(list.get(21).toString());
            }
            if (list.size() > 22 && !PlatformObjectUtils.isEmpty(list.get(22))) {
                commIndoorEquipmentEntity.setExtends5(list.get(22).toString());
            }
            if (list.size() > 23 && !PlatformObjectUtils.isEmpty(list.get(23))) {
                commIndoorEquipmentEntity.setExtends6(list.get(23).toString());
            }
            if (list.size() > 24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                commIndoorEquipmentEntity.setExtends7(list.get(24).toString());
            }
            if (list.size() > 25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                commIndoorEquipmentEntity.setExtends8(list.get(25).toString());
            }
            if (list.size() > 26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                commIndoorEquipmentEntity.setExtends9(list.get(26).toString());
            }
            if (list.size() > 27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                commIndoorEquipmentEntity.setExtends10(list.get(27).toString());
            }
            arrayList.add(commIndoorEquipmentEntity);
        }
        boolean res = false;
        for (CommIndoorEquipmentEntity commIndoorEquipmentEntity : arrayList) {
            res = lifelineRepository.saveCommIndoorEquipment(commIndoorEquipmentEntity);
        }
        if (res) {
            for (String attachId : fileIds.split(",")) {
                res = saveLifelineAttachmentRecord(attachId, PlatformSessionContext.getUserID());
            }
        }
        map.put("res", res);
        return map;
    }

    //发电厂shp
    private Map<String, Object> uploadImportantPowerhouseShp(String fileIds) throws ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res", false);
            map.put("mess", shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<ImportantPowerhouseEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 19) {
                return null;
            }
            ImportantPowerhouseEntity importantPowerhouseEntity = new ImportantPowerhouseEntity();
            importantPowerhouseEntity.setCreateUser(PlatformSessionContext.getUserID());
            importantPowerhouseEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            importantPowerhouseEntity.setDelFlag(YNEnum.N.toString());
            importantPowerhouseEntity.setAttachId(fileIds);
            importantPowerhouseEntity.setCipId(UUIDGenerator.getUUID());
            if (!PlatformObjectUtils.isEmpty(list.get(0))) {
                importantPowerhouseEntity.setGeom(list.get(0).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(1))) {
                importantPowerhouseEntity.setId(ShpAnalyticUtil.getStringVal(list.get(1).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(2))) {
                importantPowerhouseEntity.setCipName(ShpAnalyticUtil.getStringVal(list.get(2).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(3))) {
                importantPowerhouseEntity.setPosition(ShpAnalyticUtil.getStringVal(list.get(3).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(4))) {
                importantPowerhouseEntity.setLongitude(ShpAnalyticUtil.getStringVal(list.get(4).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(5))) {
                importantPowerhouseEntity.setLatitude(ShpAnalyticUtil.getStringVal(list.get(5).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(6))) {
                importantPowerhouseEntity.setYear(ShpAnalyticUtil.getIntegerVal(list.get(6).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(7))) {
                importantPowerhouseEntity.setFortificationIntensity(ShpAnalyticUtil.getStringVal(list.get(7).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(8))) {
                importantPowerhouseEntity.setInstalledCapacity(ShpAnalyticUtil.getDoubleVal(list.get(8).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(9))) {
                importantPowerhouseEntity.setGeneratingType(ShpAnalyticUtil.getStringVal(list.get(9).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(10))) {
                importantPowerhouseEntity.setCostPowerPlant(ShpAnalyticUtil.getDoubleVal(list.get(10).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(11))) {
                importantPowerhouseEntity.setCostSubstationEquipment(ShpAnalyticUtil.getDoubleVal(list.get(11).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(12))) {
                importantPowerhouseEntity.setCostGeneratingEquipment(ShpAnalyticUtil.getDoubleVal(list.get(12).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(13))) {
                importantPowerhouseEntity.setAreaSteelStructures(ShpAnalyticUtil.getDoubleVal(list.get(13).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(14))) {
                importantPowerhouseEntity.setUnitCostSteelStructure(ShpAnalyticUtil.getDoubleVal(list.get(14).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(15))) {
                importantPowerhouseEntity.setAreaReinforcedConcrete(ShpAnalyticUtil.getDoubleVal(list.get(15).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(16))) {
                importantPowerhouseEntity.setUnitCostReinforcedConcrete(ShpAnalyticUtil.getDoubleVal(list.get(16).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(17))) {
                importantPowerhouseEntity.setAreaMasonryStructure(ShpAnalyticUtil.getDoubleVal(list.get(17).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(18))) {
                importantPowerhouseEntity.setUnitCostmasonryStructure(ShpAnalyticUtil.getDoubleVal(list.get(18).toString(), "", false));
            }
            if (list.size() > 19 && !PlatformObjectUtils.isEmpty(list.get(19))) {
                importantPowerhouseEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(19).toString(), "", false));
            }
            if (list.size() > 20 && !PlatformObjectUtils.isEmpty(list.get(20))) {
                importantPowerhouseEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(20).toString(), "", false));
            }
            if (list.size() > 21 && !PlatformObjectUtils.isEmpty(list.get(21))) {
                importantPowerhouseEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(21).toString(), "", false));
            }
            if (list.size() > 22 && !PlatformObjectUtils.isEmpty(list.get(22))) {
                importantPowerhouseEntity.setExtends1(list.get(22).toString());
            }
            if (list.size() > 23 && !PlatformObjectUtils.isEmpty(list.get(23))) {
                importantPowerhouseEntity.setExtends2(list.get(23).toString());
            }
            if (list.size() > 24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                importantPowerhouseEntity.setExtends3(list.get(24).toString());
            }
            if (list.size() > 25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                importantPowerhouseEntity.setExtends4(list.get(25).toString());
            }
            if (list.size() > 26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                importantPowerhouseEntity.setExtends5(list.get(26).toString());
            }
            if (list.size() > 27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                importantPowerhouseEntity.setExtends6(list.get(27).toString());
            }
            if (list.size() > 28 && !PlatformObjectUtils.isEmpty(list.get(28))) {
                importantPowerhouseEntity.setExtends7(list.get(28).toString());
            }
            if (list.size() > 29 && !PlatformObjectUtils.isEmpty(list.get(29))) {
                importantPowerhouseEntity.setExtends8(list.get(29).toString());
            }
            if (list.size() > 30 && !PlatformObjectUtils.isEmpty(list.get(30))) {
                importantPowerhouseEntity.setExtends9(list.get(30).toString());
            }
            if (list.size() > 31 && !PlatformObjectUtils.isEmpty(list.get(31))) {
                importantPowerhouseEntity.setExtends10(list.get(31).toString());
            }
            arrayList.add(importantPowerhouseEntity);
        }
        boolean res = false;
        for (ImportantPowerhouseEntity importantPowerhouseEntity : arrayList) {
            res = lifelineRepository.saveImportantPowerhouse(importantPowerhouseEntity);
        }
        if (res) {
            for (String attachId : fileIds.split(",")) {
                res = saveLifelineAttachmentRecord(attachId, PlatformSessionContext.getUserID());
            }
        }
        map.put("res", res);
        return map;
    }

    //电缆线路shp
    private Map<String, Object> uploadCableRouteShp(String fileIds) throws ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res", false);
            map.put("mess", shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<CableRouteEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 6) {
                return null;
            }
            CableRouteEntity cableRouteEntity = new CableRouteEntity();
            cableRouteEntity.setCreateUser(PlatformSessionContext.getUserID());
            cableRouteEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            cableRouteEntity.setDelFlag(YNEnum.N.toString());
            cableRouteEntity.setAttachId(fileIds);
            cableRouteEntity.setCcrId(UUIDGenerator.getUUID());
            if (!PlatformObjectUtils.isEmpty(list.get(0))) {
                cableRouteEntity.setGeom(list.get(0).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(1))) {
                cableRouteEntity.setId(ShpAnalyticUtil.getStringVal(list.get(1).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(2))) {
                cableRouteEntity.setCcrName(ShpAnalyticUtil.getStringVal(list.get(2).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(3))) {
                cableRouteEntity.setFortificationIntensity(ShpAnalyticUtil.getStringVal(list.get(3).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(4))) {
                cableRouteEntity.setLineLength(ShpAnalyticUtil.getDoubleVal(list.get(4).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(5))) {
                cableRouteEntity.setCostLine(ShpAnalyticUtil.getDoubleVal(list.get(5).toString(), "", false));
            }
            if (list.size() > 6 && !PlatformObjectUtils.isEmpty(list.get(6))) {
                cableRouteEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(6).toString(), "", false));
            }
            if (list.size() > 7 && !PlatformObjectUtils.isEmpty(list.get(7))) {
                cableRouteEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(7).toString(), "", false));
            }
            if (list.size() > 8 && !PlatformObjectUtils.isEmpty(list.get(8))) {
                cableRouteEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(8).toString(), "", false));
            }
            if (list.size() > 9 && !PlatformObjectUtils.isEmpty(list.get(9))) {
                cableRouteEntity.setExtends1(list.get(9).toString());
            }
            if (list.size() > 10 && !PlatformObjectUtils.isEmpty(list.get(10))) {
                cableRouteEntity.setExtends2(list.get(10).toString());
            }
            if (list.size() > 11 && !PlatformObjectUtils.isEmpty(list.get(11))) {
                cableRouteEntity.setExtends3(list.get(11).toString());
            }
            if (list.size() > 12 && !PlatformObjectUtils.isEmpty(list.get(12))) {
                cableRouteEntity.setExtends4(list.get(12).toString());
            }
            if (list.size() > 13 && !PlatformObjectUtils.isEmpty(list.get(13))) {
                cableRouteEntity.setExtends5(list.get(13).toString());
            }
            if (list.size() > 14 && !PlatformObjectUtils.isEmpty(list.get(14))) {
                cableRouteEntity.setExtends6(list.get(14).toString());
            }
            if (list.size() > 15 && !PlatformObjectUtils.isEmpty(list.get(15))) {
                cableRouteEntity.setExtends7(list.get(15).toString());
            }
            if (list.size() > 16 && !PlatformObjectUtils.isEmpty(list.get(16))) {
                cableRouteEntity.setExtends8(list.get(16).toString());
            }
            if (list.size() > 17 && !PlatformObjectUtils.isEmpty(list.get(17))) {
                cableRouteEntity.setExtends9(list.get(17).toString());
            }
            if (list.size() > 18 && !PlatformObjectUtils.isEmpty(list.get(18))) {
                cableRouteEntity.setExtends10(list.get(18).toString());
            }
            arrayList.add(cableRouteEntity);
        }
        boolean res = false;
        for (CableRouteEntity cableRouteEntity : arrayList) {
            res = lifelineRepository.saveCableRoute(cableRouteEntity);
        }
        if (res) {
            for (String attachId : fileIds.split(",")) {
                res = saveLifelineAttachmentRecord(attachId, PlatformSessionContext.getUserID());
            }
        }
        map.put("res", res);
        return map;
    }

    //架空线路shp
    private Map<String, Object> uploadOverheadLineShp(String fileIds) throws ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res", false);
            map.put("mess", shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<OverheadLineEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 52) {
                return null;
            }
            OverheadLineEntity overheadLineEntity = new OverheadLineEntity();
            overheadLineEntity.setCreateUser(PlatformSessionContext.getUserID());
            overheadLineEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            overheadLineEntity.setDelFlag(YNEnum.N.toString());
            overheadLineEntity.setAttachId(fileIds);
            overheadLineEntity.setColId(UUIDGenerator.getUUID());
            if (!PlatformObjectUtils.isEmpty(list.get(0))) {
                overheadLineEntity.setGeom(list.get(0).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(1))) {
                overheadLineEntity.setId(ShpAnalyticUtil.getStringVal(list.get(1).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(2))) {
                overheadLineEntity.setColName(ShpAnalyticUtil.getStringVal(list.get(2).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(3))) {
                overheadLineEntity.setFortificationIntensity(ShpAnalyticUtil.getStringVal(list.get(3).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(4))) {
                overheadLineEntity.setVoltageGrade35(ShpAnalyticUtil.getDoubleVal(list.get(4).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(5))) {
                overheadLineEntity.setLineLength35(ShpAnalyticUtil.getDoubleVal(list.get(5).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(6))) {
                overheadLineEntity.setLoopLength35(ShpAnalyticUtil.getDoubleVal(list.get(6).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(7))) {
                overheadLineEntity.setLandform35(ShpAnalyticUtil.getStringVal(list.get(7).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(8))) {
                overheadLineEntity.setUnitCostLine35(ShpAnalyticUtil.getDoubleVal(list.get(8).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(9))) {
                overheadLineEntity.setType35(ShpAnalyticUtil.getStringVal(list.get(9).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(10))) {
                overheadLineEntity.setNumber35(ShpAnalyticUtil.getIntegerVal(list.get(10).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(11))) {
                overheadLineEntity.setUnitCostTower35(ShpAnalyticUtil.getDoubleVal(list.get(11).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(12))) {
                overheadLineEntity.setVoltageGrade66(ShpAnalyticUtil.getDoubleVal(list.get(12).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(13))) {
                overheadLineEntity.setLineLength66(ShpAnalyticUtil.getDoubleVal(list.get(13).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(14))) {
                overheadLineEntity.setLoopLength66(ShpAnalyticUtil.getDoubleVal(list.get(14).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(15))) {
                overheadLineEntity.setLandform66(ShpAnalyticUtil.getStringVal(list.get(15).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(16))) {
                overheadLineEntity.setUnitCostLine66(ShpAnalyticUtil.getDoubleVal(list.get(16).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(17))) {
                overheadLineEntity.setType66(ShpAnalyticUtil.getStringVal(list.get(17).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(18))) {
                overheadLineEntity.setNumber66(ShpAnalyticUtil.getDoubleVal(list.get(18), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(19))) {
                overheadLineEntity.setUnitCostTower66(ShpAnalyticUtil.getDoubleVal(list.get(19).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(20))) {
                overheadLineEntity.setVoltageGrade110(ShpAnalyticUtil.getDoubleVal(list.get(20).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(21))) {
                overheadLineEntity.setLineLength110(ShpAnalyticUtil.getDoubleVal(list.get(21).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(22))) {
                overheadLineEntity.setLoopLength110(ShpAnalyticUtil.getDoubleVal(list.get(22).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(23))) {
                overheadLineEntity.setLandform110(ShpAnalyticUtil.getStringVal(list.get(23).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(24))) {
                overheadLineEntity.setUnitCostLine110(ShpAnalyticUtil.getDoubleVal(list.get(24).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(25))) {
                overheadLineEntity.setType110(ShpAnalyticUtil.getStringVal(list.get(25).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(26))) {
                overheadLineEntity.setNumber110(ShpAnalyticUtil.getDoubleVal(list.get(26), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(27))) {
                overheadLineEntity.setUnitCostTower110(ShpAnalyticUtil.getDoubleVal(list.get(27).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(28))) {
                overheadLineEntity.setVoltageGrade220(ShpAnalyticUtil.getDoubleVal(list.get(28).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(29))) {
                overheadLineEntity.setLineLength220(ShpAnalyticUtil.getDoubleVal(list.get(29).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(30))) {
                overheadLineEntity.setLoopLength220(ShpAnalyticUtil.getDoubleVal(list.get(30).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(31))) {
                overheadLineEntity.setLandform220(ShpAnalyticUtil.getStringVal(list.get(31).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(32))) {
                overheadLineEntity.setUnitCostLine220(ShpAnalyticUtil.getDoubleVal(list.get(32).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(33))) {
                overheadLineEntity.setType220(ShpAnalyticUtil.getStringVal(list.get(33).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(34))) {
                overheadLineEntity.setNumber220(ShpAnalyticUtil.getDoubleVal(list.get(34), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(35))) {
                overheadLineEntity.setUnitCostTower220(ShpAnalyticUtil.getDoubleVal(list.get(35).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(36))) {
                overheadLineEntity.setVoltageGrade330(ShpAnalyticUtil.getDoubleVal(list.get(36).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(37))) {
                overheadLineEntity.setLineLength330(ShpAnalyticUtil.getDoubleVal(list.get(37).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(38))) {
                overheadLineEntity.setLoopLength330(ShpAnalyticUtil.getDoubleVal(list.get(38).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(39))) {
                overheadLineEntity.setLandform330(ShpAnalyticUtil.getStringVal(list.get(39).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(40))) {
                overheadLineEntity.setUnitCostLine330(ShpAnalyticUtil.getDoubleVal(list.get(40).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(41))) {
                overheadLineEntity.setType330(ShpAnalyticUtil.getStringVal(list.get(41).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(42))) {
                overheadLineEntity.setNumber330(ShpAnalyticUtil.getDoubleVal(list.get(42), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(43))) {
                overheadLineEntity.setUnitCostTower330(ShpAnalyticUtil.getDoubleVal(list.get(43).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(44))) {
                overheadLineEntity.setVoltageGrade500(ShpAnalyticUtil.getDoubleVal(list.get(44).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(45))) {
                overheadLineEntity.setLineLength500(ShpAnalyticUtil.getDoubleVal(list.get(45).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(46))) {
                overheadLineEntity.setLoopLength500(ShpAnalyticUtil.getDoubleVal(list.get(46).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(47))) {
                overheadLineEntity.setLandform500(ShpAnalyticUtil.getStringVal(list.get(47).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(48))) {
                overheadLineEntity.setUnitCostLine500(ShpAnalyticUtil.getDoubleVal(list.get(48).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(49))) {
                overheadLineEntity.setType500(ShpAnalyticUtil.getStringVal(list.get(49).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(50))) {
                overheadLineEntity.setNumber500(ShpAnalyticUtil.getDoubleVal(list.get(50), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(51))) {
                overheadLineEntity.setUnitCostTower500(ShpAnalyticUtil.getDoubleVal(list.get(51).toString(), "", false));
            }
            if (list.size() > 52 && !PlatformObjectUtils.isEmpty(list.get(52))) {
                overheadLineEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(52).toString(), "", false));
            }
            if (list.size() > 53 && !PlatformObjectUtils.isEmpty(list.get(53))) {
                overheadLineEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(53).toString(), "", false));
            }
            if (list.size() > 54 && !PlatformObjectUtils.isEmpty(list.get(54))) {
                overheadLineEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(54).toString(), "", false));
            }
            if (list.size() > 55 && !PlatformObjectUtils.isEmpty(list.get(55))) {
                overheadLineEntity.setExtends1(list.get(55).toString());
            }
            if (list.size() > 56 && !PlatformObjectUtils.isEmpty(list.get(56))) {
                overheadLineEntity.setExtends2(list.get(56).toString());
            }
            if (list.size() > 57 && !PlatformObjectUtils.isEmpty(list.get(57))) {
                overheadLineEntity.setExtends3(list.get(57).toString());
            }
            if (list.size() > 58 && !PlatformObjectUtils.isEmpty(list.get(58))) {
                overheadLineEntity.setExtends4(list.get(58).toString());
            }
            if (list.size() > 59 && !PlatformObjectUtils.isEmpty(list.get(59))) {
                overheadLineEntity.setExtends5(list.get(59).toString());
            }
            if (list.size() > 60 && !PlatformObjectUtils.isEmpty(list.get(60))) {
                overheadLineEntity.setExtends6(list.get(60).toString());
            }
            if (list.size() > 61 && !PlatformObjectUtils.isEmpty(list.get(61))) {
                overheadLineEntity.setExtends7(list.get(61).toString());
            }
            if (list.size() > 62 && !PlatformObjectUtils.isEmpty(list.get(62))) {
                overheadLineEntity.setExtends8(list.get(62).toString());
            }
            if (list.size() > 63 && !PlatformObjectUtils.isEmpty(list.get(63))) {
                overheadLineEntity.setExtends9(list.get(63).toString());
            }
            if (list.size() > 64 && !PlatformObjectUtils.isEmpty(list.get(64))) {
                overheadLineEntity.setExtends10(list.get(64).toString());
            }
            arrayList.add(overheadLineEntity);
        }
        boolean res = false;
        for (OverheadLineEntity overheadLineEntity : arrayList) {
            res = lifelineRepository.saveOverheadLine(overheadLineEntity);
        }
        if (res) {
            for (String attachId : fileIds.split(",")) {
                res = saveLifelineAttachmentRecord(attachId, PlatformSessionContext.getUserID());
            }
        }
        map.put("res", res);
        return map;
    }

    //变电站Shp
    private Map<String, Object> uploadTransformerSubstationShp(String fileIds) throws ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res", false);
            map.put("mess", shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<TransformerSubstationEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 17) {
                return null;
            }
            TransformerSubstationEntity transformerSubstationEntity = new TransformerSubstationEntity();
            transformerSubstationEntity.setCtsId(UUIDGenerator.getUUID());
            transformerSubstationEntity.setCreateUser(PlatformSessionContext.getUserID());
            transformerSubstationEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            transformerSubstationEntity.setDelFlag(YNEnum.N.toString());
            transformerSubstationEntity.setAttachId(fileIds);
            if (!PlatformObjectUtils.isEmpty(list.get(0))) {
                transformerSubstationEntity.setGeom(list.get(0).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(1))) {
                transformerSubstationEntity.setId(ShpAnalyticUtil.getStringVal(list.get(1).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(2))) {
                transformerSubstationEntity.setCtsName(ShpAnalyticUtil.getStringVal(list.get(2).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(3))) {
                transformerSubstationEntity.setPosition(ShpAnalyticUtil.getStringVal(list.get(3).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(4))) {
                transformerSubstationEntity.setLongitude(ShpAnalyticUtil.getStringVal(list.get(4).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(5))) {
                transformerSubstationEntity.setLatitude(ShpAnalyticUtil.getStringVal(list.get(5).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(6))) {
                transformerSubstationEntity.setTypeSubstation(ShpAnalyticUtil.getStringVal(list.get(6).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(7))) {
                transformerSubstationEntity.setVoltageGrade(ShpAnalyticUtil.getStringVal(list.get(7).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(8))) {
                transformerSubstationEntity.setStructureType(ShpAnalyticUtil.getStringVal(list.get(8).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(9))) {
                transformerSubstationEntity.setFortificationIntensity(ShpAnalyticUtil.getStringVal(list.get(9).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(10))) {
                transformerSubstationEntity.setSubstationTotalCost(ShpAnalyticUtil.getDoubleVal(list.get(10).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(11))) {
                transformerSubstationEntity.setCostHighVoltageOutdoor(ShpAnalyticUtil.getDoubleVal(list.get(11).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(12))) {
                transformerSubstationEntity.setCostIndoorEquipment(ShpAnalyticUtil.getDoubleVal(list.get(12).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(13))) {
                transformerSubstationEntity.setCostBuilding(ShpAnalyticUtil.getDoubleVal(list.get(13).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(14))) {
                transformerSubstationEntity.setYear(ShpAnalyticUtil.getIntegerVal(list.get(14).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(15))) {
                transformerSubstationEntity.setSite(ShpAnalyticUtil.getStringVal(list.get(15).toString(), "", false));
            }
            if (list.size() > 16 && !PlatformObjectUtils.isEmpty(list.get(16))) {
                transformerSubstationEntity.setProvince(ShpAnalyticUtil.getStringVal(list.get(16).toString(), "", false));
            }
            if (list.size() > 17 && !PlatformObjectUtils.isEmpty(list.get(17))) {
                transformerSubstationEntity.setCity(ShpAnalyticUtil.getStringVal(list.get(17).toString(), "", false));
            }
            if (list.size() > 18 && !PlatformObjectUtils.isEmpty(list.get(18))) {
                transformerSubstationEntity.setCounty(ShpAnalyticUtil.getStringVal(list.get(18).toString(), "", false));
            }
            if (list.size() > 19 && !PlatformObjectUtils.isEmpty(list.get(19))) {
                transformerSubstationEntity.setExtends1(list.get(19).toString());
            }
            if (list.size() > 20 && !PlatformObjectUtils.isEmpty(list.get(20))) {
                transformerSubstationEntity.setExtends2(list.get(20).toString());
            }
            if (list.size() > 21 && !PlatformObjectUtils.isEmpty(list.get(21))) {
                transformerSubstationEntity.setExtends3(list.get(21).toString());
            }
            if (list.size() > 22 && !PlatformObjectUtils.isEmpty(list.get(22))) {
                transformerSubstationEntity.setExtends4(list.get(22).toString());
            }
            if (list.size() > 23 && !PlatformObjectUtils.isEmpty(list.get(23))) {
                transformerSubstationEntity.setExtends5(list.get(23).toString());
            }
            if (list.size() > 24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                transformerSubstationEntity.setExtends6(list.get(24).toString());
            }
            if (list.size() > 25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                transformerSubstationEntity.setExtends7(list.get(25).toString());
            }
            if (list.size() > 26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                transformerSubstationEntity.setExtends8(list.get(26).toString());
            }
            if (list.size() > 27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                transformerSubstationEntity.setExtends9(list.get(27).toString());
            }
            if (list.size() > 28 && !PlatformObjectUtils.isEmpty(list.get(28))) {
                transformerSubstationEntity.setExtends10(list.get(28).toString());
            }
            arrayList.add(transformerSubstationEntity);
        }
        boolean res = false;
        for (TransformerSubstationEntity transformerSubstationEntity : arrayList) {
            res = lifelineRepository.saveTransformerSubstation(transformerSubstationEntity);
        }
        if (res) {
            for (String attachId : fileIds.split(",")) {
                res = saveLifelineAttachmentRecord(attachId, PlatformSessionContext.getUserID());
            }
        }
        map.put("res", res);
        return map;
    }

    //道路Shp
    private Map<String, Object> uploadRoadShp(String fileIds,String versionId) throws ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res", false);
            map.put("mess", shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<SmxRoadEntity> roadList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 23) {
                return null;
            }
            SmxRoadEntity roadEntity = new SmxRoadEntity();
            roadEntity.setCreateUser(PlatformSessionContext.getUserID());
            roadEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            roadEntity.setDelFlag(YNEnum.N.toString());
            roadEntity.setId(UUIDGenerator.getUUID());
            roadEntity.setCreateUserName(getUserName().getUserName());
            roadEntity.setOrgName(getUserName().getOrgName());
            if (!PlatformObjectUtils.isEmpty(list.get(0))) {
                roadEntity.setGeom(list.get(0).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(1))) {
                roadEntity.setRoadId(ShpAnalyticUtil.getStringVal(list.get(1).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(2))) {
                roadEntity.setName(ShpAnalyticUtil.getStringVal(list.get(2).toString(), "", true));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(3))) {
                roadEntity.setGrade(RoadEnum.getByCodeAndType(ShpAnalyticUtil.getIntegerVal(Integer.parseInt(list.get(3).toString()), "", true), 1));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(4))) {
                roadEntity.setStartLongitude(ShpAnalyticUtil.getStringVal(list.get(4).toString(), "", true));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(5))) {
                roadEntity.setStartLatitude(ShpAnalyticUtil.getStringVal(list.get(5).toString(), "", true));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(6))) {
                roadEntity.setEndLongitude(ShpAnalyticUtil.getStringVal(list.get(6).toString(), "", true));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(7))) {
                roadEntity.setEndLatitude(ShpAnalyticUtil.getStringVal(list.get(7).toString(), "", true));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(8))) {
                roadEntity.setIntensity(RoadEnum.getByCodeAndType(ShpAnalyticUtil.getIntegerVal(Integer.parseInt(list.get(8).toString()), "", true), 2));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(9))) {
                roadEntity.setRoadbedSoil(RoadEnum.getByCodeAndType(ShpAnalyticUtil.getIntegerVal(Integer.parseInt(list.get(9).toString()), "", true), 3));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(10))) {
                roadEntity.setSiteSoil(RoadEnum.getByCodeAndType(ShpAnalyticUtil.getIntegerVal(Integer.parseInt(list.get(10).toString()), "", true), 4));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(11))) {
                roadEntity.setFortification(RoadEnum.getByCodeAndType(ShpAnalyticUtil.getIntegerVal(Integer.parseInt(list.get(11).toString()), "", true), 5));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(12))) {
                roadEntity.setFoundationFail(RoadEnum.getByCodeAndType(ShpAnalyticUtil.getIntegerVal(Integer.parseInt(list.get(12).toString()), "", true), 6));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(13))) {
                roadEntity.setRoadbedType(RoadEnum.getByCodeAndType(ShpAnalyticUtil.getIntegerVal(Integer.parseInt(list.get(13).toString()), "", true), 7));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(14))) {
                roadEntity.setRoadbedHigh(ShpAnalyticUtil.getStringVal(list.get(14).toString(), "", true));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(15))) {
                roadEntity.setYear(ShpAnalyticUtil.getIntegerVal(list.get(15).toString(), "", true));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(16))) {
                roadEntity.setCapacity(list.get(16).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(17))) {
                roadEntity.setPavement(list.get(17).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(18))) {
                roadEntity.setLength(list.get(18).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(19))) {
                roadEntity.setWidth(list.get(19).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(20))) {
                roadEntity.setNote(list.get(20).toString());
            }
            roadEntity.setVersionId(versionId);
            roadList.add(roadEntity);
        }
        boolean res = false;

//        for (SmxRoadEntity roadEntity : roadList) {
//            RestResponse restResponse = carVulnerabilityService.crVulnerability(roadEntity);
//            if (restResponse.getCode() == 200) {
//                SmxRoadEntity data = (SmxRoadEntity) restResponse.getData();
//                res = lifelineRepository.saveRoad(data);
//            } else {
//                map.put("mess", restResponse.getMessage());
//                res = false;
//            }
//        }
//        if (res) {
//            for (String attachId : fileIds.split(",")) {
//                res = saveLifelineAttachmentRecord(attachId, PlatformSessionContext.getUserID());
//            }
//        }
        map.put("res", res);
        return map;
    }

    //桥梁shp
    private Map<String, Object> uploadBridgeShp(String fileIds) throws ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res", false);
            map.put("mess", shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<BridgeEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 24) {
                return null;
            }
            BridgeEntity bridgeEntity = new BridgeEntity();
            bridgeEntity.setCreateUser(PlatformSessionContext.getUserID());
            bridgeEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            bridgeEntity.setDelFlag(YNEnum.N.toString());
            bridgeEntity.setAttachId(fileIds);
            bridgeEntity.setCbId(UUIDGenerator.getUUID());
            if (!PlatformObjectUtils.isEmpty(list.get(0))) {
                bridgeEntity.setGeom(list.get(0).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(1))) {
                bridgeEntity.setId(list.get(1).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(2))) {
                bridgeEntity.setCbName(list.get(2).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(3))) {
                bridgeEntity.setLocation(list.get(3).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(4))) {
                bridgeEntity.setAcrossObject(list.get(4).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(5))) {
                bridgeEntity.setIntensity(list.get(5).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(6))) {
                bridgeEntity.setBuildYear(list.get(6).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(7))) {
                bridgeEntity.setStructure(list.get(7).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(8))) {
                bridgeEntity.setMaxSpan(ShpAnalyticUtil.getDoubleVal(list.get(8).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(9))) {
                bridgeEntity.setLength(ShpAnalyticUtil.getDoubleVal(list.get(9).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(10))) {
                bridgeEntity.setSiteSoil(ShpAnalyticUtil.getIntegerVal(list.get(10).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(11))) {
                bridgeEntity.setGrade(list.get(11).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(12))) {
                bridgeEntity.setFoundationFail(list.get(12).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(13))) {
                bridgeEntity.setSuperStructure(list.get(13).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(14))) {
                bridgeEntity.setBearing(list.get(14).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(15))) {
                bridgeEntity.setPierHeight(ShpAnalyticUtil.getDoubleVal(list.get(15).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(16))) {
                bridgeEntity.setPierMaterial(list.get(16).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(17))) {
                bridgeEntity.setBasement(list.get(17).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(18))) {
                bridgeEntity.setCapacity(ShpAnalyticUtil.getDoubleVal(list.get(18).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(19))) {
                bridgeEntity.setAbutmentMat(list.get(19).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(20))) {
                bridgeEntity.setAbutmentType(list.get(20).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(21))) {
                bridgeEntity.setExpansionJoint(ShpAnalyticUtil.getIntegerVal(list.get(21).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(22))) {
                bridgeEntity.setWidth(ShpAnalyticUtil.getDoubleVal(list.get(22).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(23))) {
                bridgeEntity.setNote(list.get(23).toString());
            }
            if (list.size() > 24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                bridgeEntity.setProvince(list.get(24).toString());
            }
            if (list.size() > 25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                bridgeEntity.setCity(list.get(25).toString());
            }
            if (list.size() > 26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                bridgeEntity.setCounty(list.get(26).toString());
            }
            /*if(!PlatformObjectUtils.isEmpty(list.get(27))) {
                bridgeEntity.setLongitude(list.get(27).toString());
            }
            if(!PlatformObjectUtils.isEmpty(list.get(28))) {
                bridgeEntity.setLatitude(list.get(28).toString());
            }*/
            if (list.size() > 27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                bridgeEntity.setExtends1(list.get(27).toString());
            }
            if (list.size() > 28 && !PlatformObjectUtils.isEmpty(list.get(28))) {
                bridgeEntity.setExtends2(list.get(28).toString());
            }
            if (list.size() > 29 && !PlatformObjectUtils.isEmpty(list.get(29))) {
                bridgeEntity.setExtends3(list.get(29).toString());
            }
            if (list.size() > 30 && !PlatformObjectUtils.isEmpty(list.get(30))) {
                bridgeEntity.setExtends4(list.get(30).toString());
            }
            if (list.size() > 31 && !PlatformObjectUtils.isEmpty(list.get(31))) {
                bridgeEntity.setExtends5(list.get(31).toString());
            }
            if (list.size() > 32 && !PlatformObjectUtils.isEmpty(list.get(32))) {
                bridgeEntity.setExtends6(list.get(32).toString());
            }
            if (list.size() > 33 && !PlatformObjectUtils.isEmpty(list.get(33))) {
                bridgeEntity.setExtends7(list.get(33).toString());
            }
            if (list.size() > 34 && !PlatformObjectUtils.isEmpty(list.get(34))) {
                bridgeEntity.setExtends8(list.get(34).toString());
            }
            if (list.size() > 35 && !PlatformObjectUtils.isEmpty(list.get(35))) {
                bridgeEntity.setExtends9(list.get(35).toString());
            }
            if (list.size() > 36 && !PlatformObjectUtils.isEmpty(list.get(36))) {
                bridgeEntity.setExtends10(list.get(36).toString());
            }
            arrayList.add(bridgeEntity);
        }
        boolean res = false;
        for (BridgeEntity bridgeEntity : arrayList) {
            String geom = bridgeEntity.getGeom();
            if (!PlatformObjectUtils.isEmpty(geom)) {
                if (geom.contains("POINT")) {
                    bridgeEntity.setFlag("0");
                    res = lifelineRepository.saveBridgePoint(bridgeEntity);
                } else {
                    bridgeEntity.setFlag("1");
                    res = lifelineRepository.saveBridgeLine(bridgeEntity);
                }
            } else {
                res = lifelineRepository.saveBridgePoint(bridgeEntity);
            }
        }
        if (res) {
            for (String attachId : fileIds.split(",")) {
                res = saveLifelineAttachmentRecord(attachId, PlatformSessionContext.getUserID());
            }
        }
        map.put("res", res);
        return map;
    }

    //燃气-储气罐shp
    private Map<String, Object> uploadAirReceiverShp(String fileIds) throws ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res", false);
            map.put("mess", shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<AirReceiverEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 33) {
                return null;
            }
            AirReceiverEntity airReceiverEntity = new AirReceiverEntity();
            airReceiverEntity.setCreateUser(PlatformSessionContext.getUserID());
            airReceiverEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            airReceiverEntity.setDelFlag(YNEnum.N.toString());
            airReceiverEntity.setAttachId(fileIds);
            airReceiverEntity.setCarId(UUIDGenerator.getUUID());
            if (!PlatformObjectUtils.isEmpty(list.get(0))) {
                airReceiverEntity.setGeom(list.get(0).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(1))) {
                airReceiverEntity.setId(list.get(1).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(2))) {
                airReceiverEntity.setCarName(list.get(2).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(3))) {
                airReceiverEntity.setLongitude(list.get(3).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(4))) {
                airReceiverEntity.setLatitude(list.get(4).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(5))) {
                airReceiverEntity.setStyle(list.get(5).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(6))) {
                airReceiverEntity.setCapacity(ShpAnalyticUtil.getDoubleVal(list.get(6).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(7))) {
                airReceiverEntity.setPressure(ShpAnalyticUtil.getDoubleVal(list.get(7).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(8))) {
                airReceiverEntity.setInnerDiameter(ShpAnalyticUtil.getDoubleVal(list.get(8).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(9))) {
                airReceiverEntity.setHeight(ShpAnalyticUtil.getDoubleVal(list.get(9).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(10))) {
                airReceiverEntity.setThickness(ShpAnalyticUtil.getDoubleVal(list.get(10).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(11))) {
                airReceiverEntity.setWeight(ShpAnalyticUtil.getDoubleVal(list.get(11).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(12))) {
                airReceiverEntity.setMaterial(list.get(12).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(13))) {
                airReceiverEntity.setRailLength(ShpAnalyticUtil.getDoubleVal(list.get(13).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(14))) {
                airReceiverEntity.setRailHeight(ShpAnalyticUtil.getDoubleVal(list.get(14).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(15))) {
                airReceiverEntity.setRailThickness(ShpAnalyticUtil.getDoubleVal(list.get(15).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(16))) {
                airReceiverEntity.setBaseType(list.get(16).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(17))) {
                airReceiverEntity.setMaterialType(list.get(17).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(18))) {
                airReceiverEntity.setElasticModulus(ShpAnalyticUtil.getDoubleVal(list.get(18).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(19))) {
                airReceiverEntity.setYieldStress(ShpAnalyticUtil.getDoubleVal(list.get(19).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(20))) {
                airReceiverEntity.setPermissibleStress(ShpAnalyticUtil.getDoubleVal(list.get(20).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(21))) {
                airReceiverEntity.setSite(ShpAnalyticUtil.getStringVal(list.get(21).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(22))) {
                airReceiverEntity.setLiquefaction6(ShpAnalyticUtil.getStringVal(list.get(22).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(23))) {
                airReceiverEntity.setLiquefaction7(ShpAnalyticUtil.getStringVal(list.get(23).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(24))) {
                airReceiverEntity.setLiquefaction8(ShpAnalyticUtil.getStringVal(list.get(24).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(25))) {
                airReceiverEntity.setLiquefaction9(ShpAnalyticUtil.getStringVal(list.get(25).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(26))) {
                airReceiverEntity.setSeismicSubsidence6(ShpAnalyticUtil.getStringVal(list.get(26).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(27))) {
                airReceiverEntity.setSeismicSubsidence7(ShpAnalyticUtil.getStringVal(list.get(27).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(28))) {
                airReceiverEntity.setSeismicSubsidence8(ShpAnalyticUtil.getStringVal(list.get(28).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(29))) {
                airReceiverEntity.setSeismicSubsidence9(ShpAnalyticUtil.getStringVal(list.get(29).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(30))) {
                airReceiverEntity.setYear(ShpAnalyticUtil.getIntegerVal(list.get(30).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(31))) {
                airReceiverEntity.setIntensity(ShpAnalyticUtil.getStringVal(list.get(31).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(32))) {
                airReceiverEntity.setProvince(list.get(32).toString());
            }
            if (list.size() > 33 && !PlatformObjectUtils.isEmpty(list.get(33))) {
                airReceiverEntity.setCity(list.get(33).toString());
            }
            if (list.size() > 34 && !PlatformObjectUtils.isEmpty(list.get(34))) {
                airReceiverEntity.setCounty(list.get(34).toString());
            }
            if (list.size() > 35 && !PlatformObjectUtils.isEmpty(list.get(35))) {
                airReceiverEntity.setExtends1(list.get(35).toString());
            }
            if (list.size() > 36 && !PlatformObjectUtils.isEmpty(list.get(36))) {
                airReceiverEntity.setExtends2(list.get(36).toString());
            }
            if (list.size() > 37 && !PlatformObjectUtils.isEmpty(list.get(37))) {
                airReceiverEntity.setExtends3(list.get(37).toString());
            }
            if (list.size() > 38 && !PlatformObjectUtils.isEmpty(list.get(38))) {
                airReceiverEntity.setExtends4(list.get(38).toString());
            }
            if (list.size() > 39 && !PlatformObjectUtils.isEmpty(list.get(39))) {
                airReceiverEntity.setExtends5(list.get(39).toString());
            }
            if (list.size() > 40 && !PlatformObjectUtils.isEmpty(list.get(40))) {
                airReceiverEntity.setExtends6(list.get(40).toString());
            }
            if (list.size() > 41 && !PlatformObjectUtils.isEmpty(list.get(41))) {
                airReceiverEntity.setExtends7(list.get(41).toString());
            }
            if (list.size() > 42 && !PlatformObjectUtils.isEmpty(list.get(42))) {
                airReceiverEntity.setExtends8(list.get(42).toString());
            }
            if (list.size() > 43 && !PlatformObjectUtils.isEmpty(list.get(43))) {
                airReceiverEntity.setExtends9(list.get(43).toString());
            }
            if (list.size() > 44 && !PlatformObjectUtils.isEmpty(list.get(44))) {
                airReceiverEntity.setExtends10(list.get(44).toString());
            }
            arrayList.add(airReceiverEntity);
        }
        boolean res = false;
        for (AirReceiverEntity airReceiverEntity : arrayList) {
            res = lifelineRepository.saveAirReceiver(airReceiverEntity);
        }
        if (res) {
            for (String attachId : fileIds.split(",")) {
                res = saveLifelineAttachmentRecord(attachId, PlatformSessionContext.getUserID());
            }
        }
        map.put("res", res);
        return map;
    }

    //水厂水池shp
    private Map<String, Object> uploadPoolShp(String fileIds) {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res", false);
            map.put("mess", shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<PoolEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 37) {
                return null;
            }
            PoolEntity poolEntity = new PoolEntity();
            poolEntity.setCreateUser(PlatformSessionContext.getUserID());
            poolEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            poolEntity.setDelFlag(YNEnum.N.toString());
            poolEntity.setAttachId(fileIds);
            poolEntity.setCpId(UUIDGenerator.getUUID());
            if (!PlatformObjectUtils.isEmpty(list.get(0))) {
                poolEntity.setGeom(list.get(0).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(1))) {
                poolEntity.setId(list.get(1).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(2))) {
                poolEntity.setStyle(list.get(2).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(3))) {
                poolEntity.setMaterial(list.get(3).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(4))) {
                poolEntity.setThickness(list.get(4).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(5))) {
                poolEntity.setShape(list.get(5).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(6))) {
                poolEntity.setRadius(list.get(6).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(7))) {
                poolEntity.setSlength(list.get(7).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(8))) {
                poolEntity.setLength(list.get(8).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(9))) {
                poolEntity.setCapacity(list.get(9).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(10))) {
                poolEntity.setDepth(list.get(10).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(11))) {
                poolEntity.setHeight(list.get(11).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(12))) {
                poolEntity.setJoint(list.get(12).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(13))) {
                poolEntity.setPresent(list.get(13).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(14))) {
                poolEntity.setQuality(list.get(14).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(15))) {
                poolEntity.setSurfaceShape1(list.get(15).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(16))) {
                poolEntity.setSurfaceShape2(list.get(16).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(17))) {
                poolEntity.setDiameter1(list.get(17).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(18))) {
                poolEntity.setDiameter2(list.get(18).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(19))) {
                poolEntity.setStrengthGrade(list.get(19).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(20))) {
                poolEntity.setKinds1(list.get(20).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(21))) {
                poolEntity.setKinds2(list.get(21).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(22))) {
                poolEntity.setThicknessLayer1(list.get(22).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(23))) {
                poolEntity.setThicknessLayer2(list.get(23).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(24))) {
                poolEntity.setInnerReinforcement(list.get(24).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(25))) {
                poolEntity.setOutReinforcement(list.get(25).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(26))) {
                poolEntity.setIntensity(list.get(26).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(27))) {
                poolEntity.setSite(list.get(27).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(28))) {
                poolEntity.setYear(list.get(28).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(29))) {
                poolEntity.setLiquefaction6(list.get(29).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(30))) {
                poolEntity.setLiquefaction7(list.get(30).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(31))) {
                poolEntity.setLiquefaction8(list.get(31).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(32))) {
                poolEntity.setLiquefaction9(list.get(32).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(33))) {
                poolEntity.setLandform6(list.get(33).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(34))) {
                poolEntity.setLandform7(list.get(34).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(35))) {
                poolEntity.setLandform8(list.get(35).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(36))) {
                poolEntity.setLandform9(list.get(36).toString());
            }
            if (list.size() > 37 && !PlatformObjectUtils.isEmpty(list.get(37))) {
                poolEntity.setProvince(list.get(37).toString());
            }
            if (list.size() > 38 && !PlatformObjectUtils.isEmpty(list.get(38))) {
                poolEntity.setCity(list.get(38).toString());
            }
            if (list.size() > 39 && !PlatformObjectUtils.isEmpty(list.get(39))) {
                poolEntity.setCounty(list.get(39).toString());
            }
            /*if(list.size()>40 && !PlatformObjectUtils.isEmpty(list.get(40))) {
                poolEntity.setLongitude(list.get(40).toString());
            }
            if(list.size()>41 && !PlatformObjectUtils.isEmpty(list.get(41))) {
                poolEntity.setLatitude(list.get(41).toString());
            }*/
            if (list.size() > 40 && !PlatformObjectUtils.isEmpty(list.get(40))) {
                poolEntity.setExtends1(list.get(40).toString());
            }
            if (list.size() > 41 && !PlatformObjectUtils.isEmpty(list.get(41))) {
                poolEntity.setExtends2(list.get(41).toString());
            }
            if (list.size() > 42 && !PlatformObjectUtils.isEmpty(list.get(42))) {
                poolEntity.setExtends3(list.get(42).toString());
            }
            if (list.size() > 43 && !PlatformObjectUtils.isEmpty(list.get(43))) {
                poolEntity.setExtends4(list.get(43).toString());
            }
            if (list.size() > 44 && !PlatformObjectUtils.isEmpty(list.get(44))) {
                poolEntity.setExtends5(list.get(44).toString());
            }
            if (list.size() > 45 && !PlatformObjectUtils.isEmpty(list.get(45))) {
                poolEntity.setExtends6(list.get(45).toString());
            }
            if (list.size() > 46 && !PlatformObjectUtils.isEmpty(list.get(46))) {
                poolEntity.setExtends7(list.get(46).toString());
            }
            if (list.size() > 47 && !PlatformObjectUtils.isEmpty(list.get(47))) {
                poolEntity.setExtends8(list.get(47).toString());
            }
            if (list.size() > 48 && !PlatformObjectUtils.isEmpty(list.get(48))) {
                poolEntity.setExtends9(list.get(48).toString());
            }
            if (list.size() > 49 && !PlatformObjectUtils.isEmpty(list.get(49))) {
                poolEntity.setExtends10(list.get(49).toString());
            }
            arrayList.add(poolEntity);
        }
        boolean res = false;
        for (PoolEntity poolEntity : arrayList) {
            res = lifelineRepository.savePool(poolEntity);
        }
        if (res) {
            for (String attachId : fileIds.split(",")) {
                res = saveLifelineAttachmentRecord(attachId, PlatformSessionContext.getUserID());
            }
        }
        map.put("res", res);
        return map;
    }

    //水厂泵房shp
    private Map<String, Object> uploadWaterworksShp(String fileIds) throws ShpFieldException {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res", false);
            map.put("mess", shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<WaterWorksEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 22) {
                return null;
            }
            WaterWorksEntity waterWorksEntity = new WaterWorksEntity();
            waterWorksEntity.setCreateUser(PlatformSessionContext.getUserID());
            waterWorksEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            waterWorksEntity.setDelFlag(YNEnum.N.toString());
            waterWorksEntity.setAttachId(fileIds);
            waterWorksEntity.setCwId(UUIDGenerator.getUUID());
            if (!PlatformObjectUtils.isEmpty(list.get(0))) {
                waterWorksEntity.setGeom(list.get(0).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(1))) {
                waterWorksEntity.setCwName(list.get(1).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(2))) {
                waterWorksEntity.setLongitude(list.get(2).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(3))) {
                waterWorksEntity.setLatitude(list.get(3).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(4))) {
                waterWorksEntity.setId(list.get(4).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(5))) {
                waterWorksEntity.setBuildingName(list.get(5).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(6))) {
                waterWorksEntity.setType(ShpAnalyticUtil.getStringVal(list.get(6).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(7))) {
                waterWorksEntity.setFloors(Integer.valueOf(list.get(7).toString()));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(8))) {
                waterWorksEntity.setArea(ShpAnalyticUtil.getDoubleVal(list.get(8).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(9))) {
                waterWorksEntity.setMaterial(list.get(9).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(10))) {
                waterWorksEntity.setMaterialType(list.get(10).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(11))) {
                waterWorksEntity.setSite(ShpAnalyticUtil.getStringVal(list.get(11).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(12))) {
                waterWorksEntity.setLiquefaction6(ShpAnalyticUtil.getStringVal(list.get(12).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(13))) {
                waterWorksEntity.setLiquefaction7(ShpAnalyticUtil.getStringVal(list.get(13).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(14))) {
                waterWorksEntity.setLiquefaction8(ShpAnalyticUtil.getStringVal(list.get(14).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(15))) {
                waterWorksEntity.setLiquefaction9(ShpAnalyticUtil.getStringVal(list.get(15).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(16))) {
                waterWorksEntity.setSeismicSubsidence6(ShpAnalyticUtil.getStringVal(list.get(16).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(17))) {
                waterWorksEntity.setSeismicSubsidence7(ShpAnalyticUtil.getStringVal(list.get(17).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(18))) {
                waterWorksEntity.setSeismicSubsidence8(ShpAnalyticUtil.getStringVal(list.get(18).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(19))) {
                waterWorksEntity.setSeismicSubsidence9(ShpAnalyticUtil.getStringVal(list.get(19).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(20))) {
                waterWorksEntity.setYear(ShpAnalyticUtil.getIntegerVal(list.get(20).toString(), "", false));
            }
            if (!PlatformObjectUtils.isEmpty(list.get(21))) {
                waterWorksEntity.setIntensity(ShpAnalyticUtil.getStringVal(list.get(21).toString(), "", false));
            }
            if (list.size() > 22 && !PlatformObjectUtils.isEmpty(list.get(22))) {
                waterWorksEntity.setProvince(list.get(22).toString());
            }
            if (list.size() > 23 && !PlatformObjectUtils.isEmpty(list.get(23))) {
                waterWorksEntity.setCity(list.get(23).toString());
            }
            if (list.size() > 24 && !PlatformObjectUtils.isEmpty(list.get(24))) {
                waterWorksEntity.setCounty(list.get(24).toString());
            }
            if (list.size() > 25 && !PlatformObjectUtils.isEmpty(list.get(25))) {
                waterWorksEntity.setExtends1(list.get(25).toString());
            }
            if (list.size() > 26 && !PlatformObjectUtils.isEmpty(list.get(26))) {
                waterWorksEntity.setExtends2(list.get(26).toString());
            }
            if (list.size() > 27 && !PlatformObjectUtils.isEmpty(list.get(27))) {
                waterWorksEntity.setExtends3(list.get(27).toString());
            }
            if (list.size() > 28 && !PlatformObjectUtils.isEmpty(list.get(28))) {
                waterWorksEntity.setExtends4(list.get(28).toString());
            }
            if (list.size() > 29 && !PlatformObjectUtils.isEmpty(list.get(29))) {
                waterWorksEntity.setExtends5(list.get(29).toString());
            }
            if (list.size() > 30 && !PlatformObjectUtils.isEmpty(list.get(30))) {
                waterWorksEntity.setExtends6(list.get(30).toString());
            }
            if (list.size() > 31 && !PlatformObjectUtils.isEmpty(list.get(31))) {
                waterWorksEntity.setExtends7(list.get(31).toString());
            }
            if (list.size() > 32 && !PlatformObjectUtils.isEmpty(list.get(32))) {
                waterWorksEntity.setExtends8(list.get(32).toString());
            }
            if (list.size() > 33 && !PlatformObjectUtils.isEmpty(list.get(33))) {
                waterWorksEntity.setExtends9(list.get(33).toString());
            }
            if (list.size() > 34 && !PlatformObjectUtils.isEmpty(list.get(34))) {
                waterWorksEntity.setExtends10(list.get(34).toString());
            }
            arrayList.add(waterWorksEntity);
        }
        boolean res = false;
        for (WaterWorksEntity waterWorksEntity : arrayList) {
            res = lifelineRepository.saveWaterWork(waterWorksEntity);
        }
        if (res) {
            for (String attachId : fileIds.split(",")) {
                res = saveLifelineAttachmentRecord(attachId, PlatformSessionContext.getUserID());
            }
        }
        map.put("res", res);
        return map;
    }

    //导入地下管网shp文件
    private Map<String, Object> uploadDxPipeNetworkShp(String fileIds) {
        Map<String, Object> map = new HashMap<>();
        this.uniformFileName(fileIds);
        ParsingResult shpData = getShpData(fileIds);
        //是否成功
        if (!shpData.getMessage().equals("ok")) {
            map.put("res", false);
            map.put("mess", shpData.getMessage());
        }
        List<List<Object>> shpList = shpData.getShpList();
        List<DxPipeNetworkEntity> arrayList = new ArrayList<>();
        for (int i = 0; i < shpList.size(); i++) {
            List<Object> list = shpList.get(i);
            if (list.size() < 33) {
                return null;
            }
            DxPipeNetworkEntity dxPipeNetworkEntity = new DxPipeNetworkEntity();
            dxPipeNetworkEntity.setCreateUser(PlatformSessionContext.getUserID());
            dxPipeNetworkEntity.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
            dxPipeNetworkEntity.setDelFlag(YNEnum.N.toString());
            dxPipeNetworkEntity.setAttachId(fileIds);
            dxPipeNetworkEntity.setCdpnId(UUIDGenerator.getUUID());
            if (!PlatformObjectUtils.isEmpty(list.get(0))) {
                dxPipeNetworkEntity.setGeom(list.get(0).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(1))) {
                dxPipeNetworkEntity.setId(list.get(1).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(2))) {
                dxPipeNetworkEntity.setCdpnName(list.get(2).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(3))) {
                dxPipeNetworkEntity.setCdpnClass(list.get(3).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(4))) {
                dxPipeNetworkEntity.setStartId(list.get(4).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(5))) {
                dxPipeNetworkEntity.setEndId(list.get(5).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(6))) {
                dxPipeNetworkEntity.setLongitude(list.get(6).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(7))) {
                dxPipeNetworkEntity.setLatitude(list.get(7).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(8))) {
                dxPipeNetworkEntity.setLength(list.get(8).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(9))) {
                dxPipeNetworkEntity.setMaterial(list.get(9).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(10))) {
                dxPipeNetworkEntity.setMaterialType(list.get(10).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(11))) {
                dxPipeNetworkEntity.setElasticModulus(list.get(11).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(12))) {
                dxPipeNetworkEntity.setYieldLimitStress(list.get(12).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(13))) {
                dxPipeNetworkEntity.setStrengthLimitStress(list.get(13).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(14))) {
                dxPipeNetworkEntity.setPermissibleStrain(list.get(14).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(15))) {
                dxPipeNetworkEntity.setDiameter(list.get(15).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(16))) {
                dxPipeNetworkEntity.setThickness(list.get(16).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(17))) {
                dxPipeNetworkEntity.setPressure(list.get(17).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(18))) {
                dxPipeNetworkEntity.setJoint(list.get(18).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(19))) {
                dxPipeNetworkEntity.setJointy(list.get(19).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(20))) {
                dxPipeNetworkEntity.setAllowableElongation(list.get(20).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(21))) {
                dxPipeNetworkEntity.setSite(list.get(21).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(22))) {
                dxPipeNetworkEntity.setLiquefaction6(list.get(22).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(23))) {
                dxPipeNetworkEntity.setLiquefaction7(list.get(23).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(24))) {
                dxPipeNetworkEntity.setLiquefaction8(list.get(24).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(25))) {
                dxPipeNetworkEntity.setLiquefaction9(list.get(25).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(26))) {
                dxPipeNetworkEntity.setSeismicSubsidence6(list.get(26).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(27))) {
                dxPipeNetworkEntity.setSeismicSubsidence7(list.get(27).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(28))) {
                dxPipeNetworkEntity.setSeismicSubsidence8(list.get(28).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(29))) {
                dxPipeNetworkEntity.setSeismicSubsidence9(list.get(29).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(30))) {
                dxPipeNetworkEntity.setDepth(list.get(30).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(31))) {
                dxPipeNetworkEntity.setYear(list.get(31).toString());
            }
            if (!PlatformObjectUtils.isEmpty(list.get(32))) {
                dxPipeNetworkEntity.setIntensity(list.get(32).toString());
            }
            if (list.size() > 33 && !PlatformObjectUtils.isEmpty(list.get(33))) {
                dxPipeNetworkEntity.setProvince(list.get(33).toString());
            }
            if (list.size() > 34 && !PlatformObjectUtils.isEmpty(list.get(34))) {
                dxPipeNetworkEntity.setCity(list.get(34).toString());
            }
            if (list.size() > 35 && !PlatformObjectUtils.isEmpty(list.get(35))) {
                dxPipeNetworkEntity.setCounty(list.get(35).toString());
            }
            if (list.size() > 36 && !PlatformObjectUtils.isEmpty(list.get(36))) {
                dxPipeNetworkEntity.setExtends1(list.get(36).toString());
            }
            if (list.size() > 37 && !PlatformObjectUtils.isEmpty(list.get(37))) {
                dxPipeNetworkEntity.setExtends2(list.get(37).toString());
            }
            if (list.size() > 38 && !PlatformObjectUtils.isEmpty(list.get(38))) {
                dxPipeNetworkEntity.setExtends3(list.get(38).toString());
            }
            if (list.size() > 39 && !PlatformObjectUtils.isEmpty(list.get(39))) {
                dxPipeNetworkEntity.setExtends4(list.get(39).toString());
            }
            if (list.size() > 40 && !PlatformObjectUtils.isEmpty(list.get(40))) {
                dxPipeNetworkEntity.setExtends5(list.get(40).toString());
            }
            if (list.size() > 41 && !PlatformObjectUtils.isEmpty(list.get(41))) {
                dxPipeNetworkEntity.setExtends6(list.get(41).toString());
            }
            if (list.size() > 42 && !PlatformObjectUtils.isEmpty(list.get(42))) {
                dxPipeNetworkEntity.setExtends7(list.get(42).toString());
            }
            if (list.size() > 43 && !PlatformObjectUtils.isEmpty(list.get(43))) {
                dxPipeNetworkEntity.setExtends8(list.get(43).toString());
            }
            if (list.size() > 44 && !PlatformObjectUtils.isEmpty(list.get(44))) {
                dxPipeNetworkEntity.setExtends9(list.get(44).toString());
            }
            if (list.size() > 45 && !PlatformObjectUtils.isEmpty(list.get(45))) {
                dxPipeNetworkEntity.setExtends10(list.get(45).toString());
            }
            arrayList.add(dxPipeNetworkEntity);
        }
        boolean res = false;
        for (DxPipeNetworkEntity dxPipeNetworkEntity : arrayList) {
            res = lifelineRepository.saveDxPipeNetwork(dxPipeNetworkEntity);
        }
        if (res) {
            for (String attachId : fileIds.split(",")) {
                res = saveLifelineAttachmentRecord(attachId, PlatformSessionContext.getUserID());
            }
        }
        map.put("res", res);
        return map;
    }


    @Override
    public Map<String, Object> page(QueryParamsVo queryParamsVo, int curPage, int pageSize) {
        return lifelineRepository.page(queryParamsVo, curPage, pageSize);
    }

    @Override
    public Map findById(String id, String type) {
        return lifelineRepository.findById(id, type);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Boolean update(Map<String, Object> map) {
        return lifelineRepository.update(map);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Boolean delete(Map<String, Object> map) {
        Map<String, Object> map1 = (Map<String, Object>) map.get("map");
        String ids = (String) map1.get("ids");
        String type = (String) map.get("type");
        boolean res = false;
        for (String id : ids.split(",")) {
            res = lifelineRepository.delete(id, type);
        }
        return res;
    }

    @Override
    public Map bridgeFindById(String id, String flag) {
        return lifelineRepository.bridgeFindById(id, flag);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public Boolean bridgeDelete(Map<String, Object> map) {
        Map<String, Object> map1 = (Map<String, Object>) map.get("map");
        String ids = (String) map1.get("ids");
        String flag = (String) map1.get("flag");
        boolean res = false;
        for (String id : ids.split(",")) {
            res = lifelineRepository.bridgeDelete(id, flag);
        }
        return res;
    }


    /**
     * 统一文件名
     *
     * @param fileIds
     */
    public void uniformFileName(String fileIds) {
        String[] idList = fileIds.split(",");
        AttachmentInfoEntity attachRoot = attachmentInfoService.getAttach(idList[0]);
        String attachRootPath = attachRoot.getAttachPath();
        String filePathCurrTime = getFilePathCurrTime(attachRootPath);
        for (int i = 1; i < idList.length; i++) {
            AttachmentInfoEntity attach = attachmentInfoService.getAttach(idList[i]);
            if (getFilePathCurrTime(attach.getAttachPath()).equals(filePathCurrTime)) {
                continue;
            }
            String attachPath = attach.getAttachPath();
            String fileDiskPath = localDir + attachPath;
            FileUtil.rename(new File(fileDiskPath), getNonSuffixFileName(attach.getAttachName()) + "_" + filePathCurrTime + "." + FileUtil.getSuffix(attach.getAttachName()), true);
            String[] s = attachPath.split("_");
            attach.setAttachPath(s[0] + "_" + filePathCurrTime + "." + FileUtil.getSuffix(attach.getAttachName()));
            attachmentInfoService.update(attach);
        }
    }

    public ParsingResult getShpData(String fileIds) {
        //.prj结尾用来校验是否为2000坐标系
        String prj = "";
        //.cpg文件用来获得编码格式,例如utf-8
        String cpg = "";
        //.shp文件用来获得数据
        String shp = "";
        //根据id获取真实地址
        String[] split = fileIds.split(",");
        for (String id : split) {
            //根据id和文件名获取真实的放在磁盘上的文件
            AttachmentInfoEntity attachmentInfoEntity = attachmentInfoService.getAttach(id);
            String attachPath = attachmentInfoEntity.getAttachPath();
            String substring = attachPath.substring(attachPath.length() - 4);
            if (substring.equals(".prj")) {
                prj = localDir + File.separator + attachPath;
            } else if (substring.equals(".cpg")) {
                cpg = localDir + File.separator + attachPath;
            } else if (substring.equals(".shp")) {
                shp = localDir + File.separator + attachPath;
            }
        }
        return ShpAnalyticUtil.analytic(prj, cpg, shp);
    }

    private String getFilePathCurrTime(String filePath) {
        return filePath.split("_")[1].replaceAll("." + FileUtil.getSuffix(filePath.split("_")[1]), "");
    }

    private String getNonSuffixFileName(String fileName) {
        return fileName.replaceAll("." + FileUtil.getSuffix(fileName), "");
    }

    /**
     * 获取用户名字
     *
     * @return
     */
    private SUser getUserName() {
        String user = userService.getSUser(PlatformSessionContext.getUserID());
        return CreateGson.createGson().fromJson(user, SUser.class);
    }

    private String getKeyByValue(String code, String value) {
        if (!PlatformObjectUtils.isEmpty(value)) {
            String key = dictService.getKeyByDictCodeAndValue(code, value.trim());
            return key;
        }
        return null;
    }

    private boolean saveLifelineAttachmentRecord(String attachId, String userId) {
        /*Resource resource = file.getResource();
        String fileName = resource.getFilename();*/
        LifelineAttachmentRecordEntity lifelineAttachmentRecord = new LifelineAttachmentRecordEntity();
        lifelineAttachmentRecord.setId(UUIDGenerator.getUUID());
        lifelineAttachmentRecord.setAttachId(attachId);
        //lifelineAttachmentRecord.setAttachName(fileName);
        lifelineAttachmentRecord.setType("1");
        lifelineAttachmentRecord.setFileType("0");
        lifelineAttachmentRecord.setCreateUser(userId);
        lifelineAttachmentRecord.setCreateTime(new Date());
        lifelineAttachmentRecord.setDelFlag("0");
        return lifelineRepository.saveLifelineAttachmentRecord(lifelineAttachmentRecord);
    }

    @Override
    public List<SmxVersionEntity> getRepeatData(RegionParam param) {
        String userID = PlatformSessionContext.getUserID();
        String fileName = attachmentInfoService.getAttach(param.getFileIds().split(",")[0]).getAttachName();
        String name = fileName.split("\\.")[0];
        return lifelineRepository.getByRegionAndUserAndType(param,userID,name);
    }
}
